package com.yoomiito.app.ui.college.detail

import androidx.recyclerview.widget.RecyclerView
import android.view.ViewGroup
import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yoomiito.app.R
import com.yoomiito.app.utils.DensityUtil
import com.yoomiito.app.utils.ImageLoader
import com.yoomiito.app.utils.L

class SubjectIntroductionAdapter(s: List<String>?) : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_iv, s) {

    override fun convert(helper: BaseViewHolder?, item: String?) {
        helper?.getView<ImageView>(R.id.item_iv).let {
            val lp = it?.layoutParams as androidx.recyclerview.widget.RecyclerView.LayoutParams
            lp?.height = ViewGroup.LayoutParams.WRAP_CONTENT
            if(helper?.layoutPosition!!<=2){
                lp?.topMargin = DensityUtil.dp2px(10F)
            }else{
                lp?.topMargin = DensityUtil.dp2px(0F)
            }

            ImageLoader.getInstance().intoAllSize(it?.context, item, it, R.drawable.goods_default)
        }

    }

}